/*
============================================================================
 Name        : GprsTools.h
 Author      : 王斌
 Version     :
 Copyright   : 益盟软件
 Description : CGprsTools declaration
============================================================================
*/

#ifndef GPRSTOOLS_H
#define GPRSTOOLS_H

// INCLUDES
#include <e32std.h>
#include <e32base.h>


#include <commdb.h>
#include <CommDbConnPref.h>
#include <es_sock.h>
#include "ThreadSocket.h"
// CLASS DECLARATION

class RHTTPSession;
/**
*  CGprsTools
* 
*/
class CGprsTools : public CActive
{
public: // Constructors and destructor

	/**
        * Destructor.
        */
	~CGprsTools();

        /**
        * Two-phased constructor.
        */
	static CGprsTools* NewL();

        /**
        * Two-phased constructor.
        */
	static CGprsTools* NewLC();

private:

	/**
        * Constructor for performing 1st stage construction
        */
	CGprsTools();

	/**
        * EPOC default constructor for performing 2nd stage construction
        */
	void ConstructL();

private: // Functions from base classes

	/**
	* From CActive
	*/
	void RunL();

	/**
	* From CActive
	*/
	void DoCancel();
private:
	void GetProxy(const TUint32& ap);

public:
	TBool SetupConnectL();

	TBool OpenHttpSession(RHTTPSession& aSession,CThreadSocket*	aThreadSocket);

	void ResetConnectL();

//#ifdef __SERIES60_3X__
//	void GetApList(RArray<TIapData>& aApArray);
//#endif
public:
	RSocketServ 			iSocketServ;
	RConnection 			iConnection;

	//TBool					iConnectionSetupDone;
	TInt					iConnectCount;

	CThreadSocket*			iThreadSocket;
private:
	TBool					iBoolUseProxy;
	TUint32					iAccessPoint;
	//TBuf<128>				iProxy;
};

#endif // GPRSTOOLS_H
